package net.sdd.oss.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

//1、创建对象加入容器。  <bean id="ossConstan" class="" />
@Component
public class OssConstant {
    @Value("${aliyun.oss.endpoint}")
    private String endpoint;
    @Value("${aliyun.oss.accessKey}")
    private String accessKey;
    @Value("${aliyun.oss.secret}")
    private String secret;
    @Value("${aliyun.oss.bucket}")
    private String bucket;

    public static String ENDPOINT;
    public static String ACCESS_KEY;
    public static String SECRET;
    public static String BUCKET;

    //2、@PostConstruct 表示创建对象之后执行。
    // 相当于配置文件中的init-method初始化方法： <bean id="ossConstan" class="" init-method="init" />
    @PostConstruct
    public void init() {
        ENDPOINT = this.endpoint;
        ACCESS_KEY = this.accessKey;
        SECRET = this.secret;
        BUCKET = this.bucket;
    }
}
